{% extends "base.html" %}

{% block content %}

<script>
        $(document).ready(function(){
            // Pre-populated initial data at page load
            var content_data = {{ content_data }};

            var refresh = function() {
                $.get("{{ url_prefix }}/rgw/rgw_daemons_data", function(data) {
                    content_data = data;
                    setTimeout(refresh, 5000);
                });
            };
            setTimeout(refresh, 5000);
 
            console.log(content_data);
            rivets.bind($("#content"), {rgw: content_data});
        });
</script>

<section class="content-header">
    <h1>
        RGW daemons
    </h1>
</section>

<section class="content">
    <div class="box">
        <div class="box-body">
            <table class="table table-bordered">
                <th>
                    ID
                </th>
                <th>
                    Hostname
                </th>
                <th>
                    Version
                </th>
                </thead>
                <tr rv-each-rgwdaemon="rgw.daemons">
                    <td>
                        <a rv-href="rgwdaemon.url">{rgwdaemon.id}</a>
                    </td>
                    <td>
                        {rgwdaemon.server_hostname}
                    </td>
                    <td>
                        {rgwdaemon.version | short_version}
                    </td>

                </tr>
            </table>
        </div>
    </div>
</section>
<!-- /.content -->

{% endblock %}
